capture log close
log using C:\data\UI_2020\logs\UI-rep_Sec_3.log, replace
*************************************************************************
* Created by: 	Rob Valletta						
* Created on: 	05/19/2022
* Description: 	List tabulations of UI_rep distribution by occ and ind
* Modified on:	3/26/24 (RV): Simplify for Section 3 calculations
*		(using majocc, data includes full occ variable)
*************************************************************************

version 15
clear *
set more off
capture program drop _all
cd C:\data\UI_2020
set linesize 240

** Pull in analysis extract 
use data\CPS_2020_unbalanced_v2.dta, clear

** FORM UI REPLACEMENT RATE (WITH $600 SUPP), DROP 0'S and DC
gen UI_rep=(UI_CARES/weekly_earnings)
  replace UI_rep=0 if UI_rep==.
drop if UI_rep==0
drop if st=="DC"

** SET NEG MAJOCC TO MISSING
replace majind=. if majind<=0
replace majocc=. if majocc<=0

** Label majocc variable
#d ;
label define occ 1 "Manag" 2 "Prof_tech" 3 "Services" 4 "Sales" 5 "Admin" 6 "Farm_Fish"
7 "Const_Extract" 8 "Inst_Maint_Rep" 9 "Production" 10 "Trans_Materials" 11 "Armed_Forces";
#d cr
label values majocc occ
label variable majocc "Major occupation recode"

** RESTRICT TO UNEMPLOYED
keep if U==1


** DO TABULATIONS OF REP RATE
** Overall
summ UI_rep* if (UI_rep>0) [aw=wgtbls], det
** April 2020-forward only
summ UI_rep* if (UI_rep>0  & month>3) [aw=wgtbls], det

** Set up table by majocc
  ** Form uniform row variable
gen all=1
  ** Majocc
table all majocc [aw=wgtbls], c(mean UI_rep sd UI_rep n UI_rep) col format(%4.3f)

keep UI* month weekly_earnings occ majocc wgtbls age educ
save data\CPS-2020_ASEC-monthly_for_Sec_3, replace
summ

log close
